/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.gp.ui.command;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "command", catalog = "xiaomu", schema = "")
@NamedQueries({
    @NamedQuery(name = "Command.findAll", query = "SELECT c FROM Command c"),
    @NamedQuery(name = "Command.findById", query = "SELECT c FROM Command c WHERE c.id = :id"),
    @NamedQuery(name = "Command.findByCommandType", query = "SELECT c FROM Command c WHERE c.commandType = :commandType"),
    @NamedQuery(name = "Command.findByCommandName", query = "SELECT c FROM Command c WHERE c.commandName = :commandName"),
    @NamedQuery(name = "Command.findByCommandParam", query = "SELECT c FROM Command c WHERE c.commandParam = :commandParam"),
    @NamedQuery(name = "Command.findByCommandExample", query = "SELECT c FROM Command c WHERE c.commandExample = :commandExample"),
    @NamedQuery(name = "Command.findByRemark", query = "SELECT c FROM Command c WHERE c.remark = :remark")})
public class Command implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "command_type")
    private String commandType;
    @Basic(optional = false)
    @Column(name = "command_name")
    private String commandName;
    @Basic(optional = false)
    @Column(name = "command_param")
    private String commandParam;
    @Column(name = "command_example")
    private String commandExample;
    @Column(name = "remark")
    private String remark;

    public Command() {
    }

    public Command(Integer id) {
        this.id = id;
    }

    public Command(Integer id, String commandType, String commandName, String commandParam) {
        this.id = id;
        this.commandType = commandType;
        this.commandName = commandName;
        this.commandParam = commandParam;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getCommandType() {
        return commandType;
    }

    public void setCommandType(String commandType) {
        String oldCommandType = this.commandType;
        this.commandType = commandType;
        changeSupport.firePropertyChange("commandType", oldCommandType, commandType);
    }

    public String getCommandName() {
        return commandName;
    }

    public void setCommandName(String commandName) {
        String oldCommandName = this.commandName;
        this.commandName = commandName;
        changeSupport.firePropertyChange("commandName", oldCommandName, commandName);
    }

    public String getCommandParam() {
        return commandParam;
    }

    public void setCommandParam(String commandParam) {
        String oldCommandParam = this.commandParam;
        this.commandParam = commandParam;
        changeSupport.firePropertyChange("commandParam", oldCommandParam, commandParam);
    }

    public String getCommandExample() {
        return commandExample;
    }

    public void setCommandExample(String commandExample) {
        String oldCommandExample = this.commandExample;
        this.commandExample = commandExample;
        changeSupport.firePropertyChange("commandExample", oldCommandExample, commandExample);
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        String oldRemark = this.remark;
        this.remark = remark;
        changeSupport.firePropertyChange("remark", oldRemark, remark);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Command)) {
            return false;
        }
        Command other = (Command) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.gp.ui.command.Command[ id=" + id + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
